$(function(){
chart =new Highcharts.chart(
	{
    chart: {
    	renderTo : 'knowledgeContainer', // 页面DIV层ID
        type: 'pie',
        options3d: {
            enabled: true,
            alpha: 45,
            beta: 0
        }
    },
    title: {
        text: "<div style='text-align: center;font-size: 16px;font-weight: bold;'>知识库分类统计</div>"
    },
    tooltip: {
        pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
    },
    plotOptions: {
        pie: {
            allowPointSelect: true,
            cursor: 'pointer',
            depth: 35,
            dataLabels: {
                enabled: true,
                format: '{point.name}'
            }
        }
    },
    series: [{
        type: 'pie',
        name: '资料占比',
        data: [
            ['POC资料', 45.0],
            ['售前资料', 25.0],
            ['产品基础资料', 10.0],
            ['交付资料', 10.0],
            ['其他', 10.0]
        ]
    }]
});
});
function getFrom() {
    jQuery.ajax({
        url: basePath+"report/reportknowledgeContainer",
        contentType: 'text/json,charset=utf-8',
        type: "post",
        async: false,
        data: { Action: "data", AjaxFllage: true },
        success: function (data) {
        	//console.log(data);
        	var json = eval("(" + data + ")");
        	var arr = new Array();
        	for (i in json) {
        		//alert(json[i].name);
        		var value = [json[i].name, parseInt(json[i].count)];
        		arr.push(value); 
        	}
        	chart.series[0].setData(arr);
        }
    });

    //chart.series[0].addPoint(1);
}

$(document).ready(function () {
    //每隔1秒自动调用方法，实现图表的实时更新  
	// window.setInterval(getmsg, 15000);
	// getFrom();
	// getTasksResult();
});
/*
$(function () {
	$.ajax({
        type:"post",
        url:basePath+"report/countClientByMonth",
        data:{},
        cache:false,
        dataType: "json", 
        success:function(result) {  
        	console.log(result);
        	var count = JSON.parse(result.count);
        	var month = JSON.parse(result.month);
        	var chart = new Highcharts.Chart({
        	    chart: {
        	        renderTo: 'contactContainer',
        	        type: 'column',
        	        options3d: {
        	            enabled: true,
        	            alpha: 0,
        	            beta: 15,
        	            depth: 50,
        	            viewDistance: 25
        	        }
        	    },
        	    title: {
					text: "<div style='text-align: center;font-size: 16px;font-weight: bold;'>每月新增客户统计</div>"
        	    },
        	    subtitle: {
        	        text: ''
        	    },
        	    xAxis: {
        	        categories: month,
        	        crosshair: true
        	    },
        	    yAxis: {
        	        min: 0,
        	        title: {
        	            text: '新增客户数(个)'
        	        }
        	    },
        	    plotOptions: {
        	        column: {
        	        	pointWidth: 30
        	        }
        	    },
        	    series: [{
        	    	name:"客户",
        	        data:count
        	    }]
        	});
        }
    });
}); 
*/

